package edu.hcmus.sow.dao;

import java.util.List;

import org.hibernate.criterion.Restrictions;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import edu.hcmus.sow.domain.Site;

/**
 * DAO to manage Site entities.
 * 
 */
@Repository
@Transactional
public class SiteDAOImpl extends AbstractHibernateDAO<Site, Integer> implements SiteDAO {

   public Site findBySubDomain(String subDomain) throws DataAccessException {
      List<Site> list = findByCriteria(Restrictions.eq("subDomain", subDomain));
      return list.size() == 0 ? null : list.get(0);
   }
}
